package com.bac.rentmap.osmimport;

/**
 *
 * @author Ivan Holub
 */
public class HighwayRange {

    private String minLat;

    private double minLatDouble = Double.MAX_VALUE;

    private String minLon;

    private double minLonDouble = Double.MAX_VALUE;

    private String maxLat;

    private double maxLatDouble;

    private String maxLon;

    private double maxLonDouble;

    public String getMinLat() {
        return minLat;
    }

    public String getMinLon() {
        return minLon;
    }

    public String getMaxLat() {
        return maxLat;
    }

    public String getMaxLon() {
        return maxLon;
    }

    public void acceptLat(String lat) {
        double latDouble = Double.valueOf(lat);
        if (latDouble < minLatDouble) {
            minLatDouble = latDouble;
            minLat = lat;
        }
        if (latDouble > maxLatDouble) {
            maxLatDouble = latDouble;
            maxLat = lat;
        }
    }

    public void acceptLon(String lon) {
        double lonDouble = Double.valueOf(lon);
        if (lonDouble < minLonDouble) {
            minLonDouble = lonDouble;
            minLon = lon;
        }
        if (lonDouble > maxLonDouble) {
            maxLonDouble = lonDouble;
            maxLon = lon;
        }
    }

    public String getMedianLat() {
        double m = (minLatDouble + maxLatDouble) / 2;
        return String.valueOf(m);
    }

    public String getMedianLon() {
        double m = (minLonDouble + maxLonDouble) / 2;
        return String.valueOf(m);
    }

}